[mirrors]
http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz

[vars]
filesize=15920544
sha512=4ccd8c4fc15dd9abc43f93b62f0b1349c419a2afeba05304fa98c157325e31dbbdb1587afc18d0a3f5dba14c95d64a3d40a825efe89ddf6f93fa96002496675c
tardir=llvm-3.4

[deps.host]
cmake

[deps]
libffi
clang34
compiler-rt34

[build]
tar xf "$C"/clang-3.4.src.tar.gz
mv ./clang-3.4 ./tools/clang
tar xf "$C"/compiler-rt-3.4.src.tar.gz
mv ./compiler-rt-3.4 ./projects/compiler-rt

patch -p1 < "$K"/llvm34.patch
patch -p1 < "$K"/llvm34-dynlinker.patch

conflags='--enable-libffi --enable-optimized --enable-shared
	--disable-docs --enable-targets=all --prefix='"$butch_prefix"
if [ ! -z "$DEBUGBUILD" ] ; then
	conflags='--enable-debug-runtime --enable-debug-symbols
	--enable-keep-symbols --enable-libffi --enable-optimized
	--enable-shared --disable-docs --enable-targets=all --prefix='"$butch_prefix"
fi
./configure $conflags

# For whatever reason, PROJ_INSTALL_ROOT doesn't get defined when building sample.
sed -i '/$(error Projects must define PROJ_INSTALL_ROOT)/c\
PROJ_INSTALL_ROOT := '"$butch_install_dir"'' ./projects/sample/Makefile.llvm.config

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install
